Add New Btrfs Partition To My System

Meow King January 08, 2024 Updated: January 08, 2024 #btrfs #partition #system #linux
lsblk # or lsblk -f
mkfs.btrfs -L "myArch-extra" /dev/nvme0n1p8 # use -f to force clear existing data
mkdir /mnt/p0

# create subvolume in drive
mount -t btrfs -o compress=zstd /dev/nvme0n1p8 /mnt/p0
btrfs subvolume create /mnt/@
umount /mnt/p0

# mount 
mount -t btrfs -o subvol=/@,compress=zstd /dev/nvme0n1p8 /mnt/p0/

# genfstab to stdout

# run either to view the result and copy-paste necessary data to /etc/fstab
genfstab -U / # note that appimage mount is also included
genfstab -U /mnt/p0/ # note that partition point is wrong ('/', should be '/mnt/p0')

umount /mnt/p0
systemctl daemon-reload # reload /etc/fstab
mount -a # mount all point mentioned in /etc/fstab, for test purpose

chmod ugo+wx /mnt/p0/ # gain access